﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;

namespace T2task1
{
    class DBHelper
    {
        public static string connStr = "server=.;database=Game;Integrated Security=true";



        public static SqlDataReader Select(string sql)
        {
            SqlConnection conn = new SqlConnection(connStr);
            conn.Open();
            SqlCommand cmd = new SqlCommand(sql, conn);
            return cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);


        }


        public static bool GetN(string sql)
        {
            bool result = false;
            SqlConnection conn = new SqlConnection(connStr);
            conn.Open();
            SqlCommand cmd = new SqlCommand(sql, conn);
            int numder = cmd.ExecuteNonQuery();
            if (numder > 0)
            {
                result = true;
            }

            return result;
        }




    }
}
